<template>
  <div class="app-container table-app-container">
    <div class="block versions-tab">
      <el-timeline>
        <el-timeline-item v-for="item in list" :key="item.id" :timestamp="utc2local(item.createTime)" placement="top">
          <el-card shadow="never">
            <div class="modify-desc">
              <div> <span class="label">生命周期：</span><span class="value">{{ item.lifeCycle }}</span></div>
              <!-- <div> <span class="label">操作人：</span><span class="value">{{ item.userName }}</span></div> -->
              <div><span class="label">工单号：</span><span class="value">{{ item.workNum }}</span></div>
              <div><span class="label">详细：</span><span class="value">{{ item.content }}</span></div>
            </div>
          </el-card>
        </el-timeline-item>
      </el-timeline>
    </div>
  </div>
</template>

<script>
import { formatDate } from '@neu/biz-core/utils/utils'

import { lifeByCode } from '@neu/dcam-ui/api/fixedAsset'
export default {
  name: 'LifeCyclePage',
  data() {
    return {
      list: []
    }
  },
  created() {
    this.getInfo()
  },
  methods: {
    getInfo() {
      if (this.$attrs.asset) {
        lifeByCode(this.$attrs.asset).then(res => {
          this.list = res.data
        })
      }
    },
    // utc时间转本地时间
    utc2local(utc) {
      return formatDate(utc, 'YYYY-MM-DD HH:mm')
    }
  }
}
</script>

<style lang="scss">
.modify-desc {
  margin: 10px 0;
  div {
    display: inline-block;
    margin-right: 10px;

    .label {
      color: #606266;
    }
  }
}
</style>
